import tensorflow as tf
import tf2onnx


tf.compat.v1.disable_eager_execution()

with tf.compat.v1.Session() as sess:
    x = tf.compat.v1.placeholder(tf.int32, shape=(2, 2), name="x")
    output_data = tf.raw_ops.Abs(x=x, name="output")
    onnx_graph = tf2onnx.tfonnx.process_tf_graph(sess.graph, opset=17, input_names=["x:0"], output_names=["output:0"])
    model_proto = onnx_graph.make_model("test")
    with open("/home/ubuntu/onnx_samples/onnx_transformer/source/"
              "tf.raw_ops.Abs.onnx", "wb") as f:
        f.write(model_proto.SerializeToString())
